package mashibing.class1;

import util.MathUtil;

import java.util.Arrays;

/**
 * @author yujiafan
 * @version 1.0.0
 * @create 2023-03-04
 */
public class Class1_Test {

    public static void main(String[] args) {
        int testCount = 50000;
        boolean flag = true;
        System.out.println("begin");
        for (int i = 0; i < testCount; i++) {
            int[] arr = MathUtil.generateArray(100,100);
            int[] arr1 = MathUtil.copyArray(arr);
            int[] arr2 = MathUtil.copyArray(arr);
            int[] arr3 = MathUtil.copyArray(arr);
            Class1_1_SelectionSorted.selectSort(arr1);
            Class1_2_BubbleSorted.bubbleSort(arr2);
            Class1_3_InsertSorted.insertSort(arr3);
            if(!MathUtil.isEqualArray(arr1,arr2) || !MathUtil.isEqualArray(arr2,arr3)){
                flag = false;
                System.out.println("error!");
                System.out.println(Arrays.toString(arr));
                break;
            }
        }
        if (flag){
            System.out.println("success!");
        }


//        int[] arr = {8, 5, 3, 9, 8, 6, 2, 5};
//        int[] arr1 = MathUtil.copyArray(arr);
//        int[] arr2 = MathUtil.copyArray(arr);
//        Class1_1_SelectionSorted.selectSort(arr);
//        Class1_2_BubbleSorted.bubbleSort(arr1);
//        Class1_3_InsertSorted.insertSort(arr2);
//        System.out.println(Arrays.toString(arr));
//        System.out.println(Arrays.toString(arr1));
//        System.out.println(Arrays.toString(arr2));
    }
}
